package cn.mesmile.gateway.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zb
 * @version 1.0
 * @date 2020/10/26 12:33
 * @description   @RefreshScope 获取动态刷新的配置    @RefreshScope
 */
@RequestMapping("/api/v1/get")
@RestController
@RefreshScope
public class GatewayConfigRefresh {

    @Value("${gateway.title}")
    private String gatewayTitle;

    @GetMapping("/test")
    public Object test(){
        Map<String, String> map = new HashMap<>();
        map.put("动态值网关标题",gatewayTitle);
        map.put("标题","这是一段测试的标题");
        return map;
    }

}
